package com.itheima.dcp.demo1;

import java.io.IOException;
import java.net.DatagramPacket;
import java.net.InetAddress;
import java.net.MulticastSocket;

public class ServerDemo{
    public static void main(String[] args) throws IOException {
        MulticastSocket ms=new MulticastSocket(10000);
        byte[] bytes=new byte[1024];
        DatagramPacket dp=new DatagramPacket(bytes,1024);
        ms.joinGroup(InetAddress.getByName("224.0.1.0"));
        //byte[] data = dp.getData();
        //int length = dp.getLength();
        ms.receive(dp);
        System.out.println(new String(bytes));
        ms.close();

    }
}
